package homework;

/**
 * @Author Stringzhua
 * @Date 2024/1/23 19:56
 * description:位运算思考题
 */
public class test03 {
    public static void main(String[] args) {
        int a = 1 >> 2;//1向右位移2位
        int b = -1 >> 2;//-1向右位移2位
        int c = 1 << 2;//1向左位移2位
        int d = -1 << 2;//-1向左位移2位
        int e = 3 >>> 2;//算数右移
        int f=~2;//按位取反
        int g=2&3;//按位与
        int h=2|3;//按位或
        int i=~-5;
        int j=13&7;
        int k=5|4;
        int l=-3^3;//按位异或
        System.out.println("a = " + a);
        System.out.println("b = " + b);
        System.out.println("c = " + c);
        System.out.println("d = " + d);
        System.out.println("e = " + e);
        System.out.println("f = " + f);
        System.out.println("g = " + g);
        System.out.println("h = " + h);
        System.out.println("i = " + i);
        System.out.println("j = " + j);
        System.out.println("k = " + k);
        System.out.println("l = " + l);
    }
}
